package com.batchaps.gameentity;

import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class MenuFuntionItem extends Game2DEntity {

	private Image _textureIcon;

	private int _itexture;

	private int _posX;

	private int _posY;

	private int _sizeX;
	private int _sizeY;

	private String _text;

	private int _positionTextX;
	private int _positionTextY;

	private boolean isDraw;

	// private SpriteFont _font;

	public boolean FlagUpdate;

	public MenuFuntionItem(String textureicons, int posX, int posY, int sizeX,
			int sizeY, String text, int postextX, int postextY, boolean isdraw) {
		try {
			_textureIcon = Image.createImage(textureicons);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		_itexture = 0;
		_posX = posX;
		_posY = posY;
		_sizeX = sizeX;
		_sizeY = sizeY;

		_text = text;
		_positionTextX = postextX;
		_positionTextY = postextY;

		isDraw = isdraw;

		// _font = content.Load<SpriteFont>("SpriteFont1");

		FlagUpdate = true;
	}

	public boolean IsClick(int posX, int posY) {
		if (isDraw) {
			if ((posX >= _posX && posX <= _posX + _sizeX)
					&& (posY >= _posY && posY <= _posY + _sizeY)) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}

	public void Update() {
		/*
		 * if (FlagUpdate) _itexture = (_itexture + 1) % _textureIcon.Count;
		 */
	}

	public void Draw(Graphics g, float gametime) {
		if (isDraw) {
			g.drawImage(_textureIcon, _posX, _posY, 0);

			// spriteBatch.DrawString(_font, _text, _positionText, Color.White);
		}
		// base.Draw(spriteBatch);
	}

	/**
	 * @return the _textureIcon
	 */
	public Image get_textureIcon() {
		return _textureIcon;
	}

	/**
	 * @param _textureIcon the _textureIcon to set
	 */
	public void set_textureIcon(Image _textureIcon) {
		this._textureIcon = _textureIcon;
	}

	/**
	 * @return the _itexture
	 */
	public int get_itexture() {
		return _itexture;
	}

	/**
	 * @param _itexture the _itexture to set
	 */
	public void set_itexture(int _itexture) {
		this._itexture = _itexture;
	}

	/**
	 * @return the _posX
	 */
	public int get_posX() {
		return _posX;
	}

	/**
	 * @param _posX the _posX to set
	 */
	public void set_posX(int _posX) {
		this._posX = _posX;
	}

	/**
	 * @return the _posY
	 */
	public int get_posY() {
		return _posY;
	}

	/**
	 * @param _posY the _posY to set
	 */
	public void set_posY(int _posY) {
		this._posY = _posY;
	}

	/**
	 * @return the _sizeX
	 */
	public int get_sizeX() {
		return _sizeX;
	}

	/**
	 * @param _sizeX the _sizeX to set
	 */
	public void set_sizeX(int _sizeX) {
		this._sizeX = _sizeX;
	}

	/**
	 * @return the _sizeY
	 */
	public int get_sizeY() {
		return _sizeY;
	}

	/**
	 * @param _sizeY the _sizeY to set
	 */
	public void set_sizeY(int _sizeY) {
		this._sizeY = _sizeY;
	}

	/**
	 * @return the _text
	 */
	public String get_text() {
		return _text;
	}

	/**
	 * @param _text the _text to set
	 */
	public void set_text(String _text) {
		this._text = _text;
	}

	/**
	 * @return the _positionTextX
	 */
	public int get_positionTextX() {
		return _positionTextX;
	}

	/**
	 * @param _positionTextX the _positionTextX to set
	 */
	public void set_positionTextX(int _positionTextX) {
		this._positionTextX = _positionTextX;
	}

	/**
	 * @return the _positionTextY
	 */
	public int get_positionTextY() {
		return _positionTextY;
	}

	/**
	 * @param _positionTextY the _positionTextY to set
	 */
	public void set_positionTextY(int _positionTextY) {
		this._positionTextY = _positionTextY;
	}

	/**
	 * @return the isDraw
	 */
	public boolean isDraw() {
		return isDraw;
	}

	/**
	 * @param isDraw the isDraw to set
	 */
	public void setDraw(boolean isDraw) {
		this.isDraw = isDraw;
	}

	/**
	 * @return the flagUpdate
	 */
	public boolean isFlagUpdate() {
		return FlagUpdate;
	}

	/**
	 * @param flagUpdate the flagUpdate to set
	 */
	public void setFlagUpdate(boolean flagUpdate) {
		FlagUpdate = flagUpdate;
	}

}
